package org.travel_system.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.travel_system.mapper.RestaurantMapper;
import org.travel_system.pojo.Restaurant;
import org.travel_system.service.RestaurantService;

import java.util.List;

@Service
public class RestaurantServiceImpl implements RestaurantService {

    private final RestaurantMapper restaurantMapper;

    @Autowired
    public RestaurantServiceImpl(RestaurantMapper restaurantMapper) {this.restaurantMapper = restaurantMapper;}

    @Override
    public List<Restaurant> getRestaurants() {
        return restaurantMapper.getRestaurants();
    }

    @Override
    public Restaurant getRestaurantByName(String name) {
        return restaurantMapper.getRestaurantByName(name);
    }

    @Override
    public List<Restaurant> getSearchRestaurantByName(String name) {
        return restaurantMapper.getSearchRestaurantByName(name);
    }

    @Override
    public int addRestaurant(Restaurant restaurant) {

        return restaurantMapper.addRestaurant(restaurant);
    }

    @Override
    public int deleteRestaurantByName(String name) {
        return restaurantMapper.deleteRestaurantByName(name);
    }

    @Override
    public int updateRestaurant(Restaurant restaurant) {
        return restaurantMapper.updateRestaurant(restaurant);
    }
}
